'use strict';
const cloudbase = require("@cloudbase/node-sdk");

const app = cloudbase.init({});

const db = app.database();

const { businessRegister, businessLogin, changeBusinessUserInfo, addWork,getWork1,getWork2 } = require('./hanlder/user.js');

const { verifyToken } = require('./utilstFun.js');
exports.main = async (event, context) => {
    const { action } = event;
    if (action === 'businessRegister') {  // 商家注册
        return businessRegister(event);
    }
    else if (action === 'businessLogin') {  // 商家登陆
        return businessLogin(event);
    }
    else if (action === 'changeBusinessUserInfo') { // 企业修改个人资料
        return changeBusinessUserInfo(event);
    }
    else if (action === 'addWork') {
        return addWork(event);
    }
    else if(action === 'getWork1'){//获取企业个人招聘中的工作
        return getWork1(event);
    }
    else if(action ==='getWork2'){//获取企业个人已下线的工作
        return getWork2(event);
    }
    return {
        status: 500,
        message: '参数错误',
        ...event
    };
};
